package com.crm.mapper.system;

import com.crm.aonnation.AutoFill;
import com.crm.dto.RolePageDTO;
import com.crm.enumeration.OperationType;
import com.crm.pojo.Role;
import com.github.pagehelper.Page;
import lombok.ToString;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {
    Page<Role> list(RolePageDTO rolePageDTO);

    @Select("select * from sys_role where role_id = #{id}")
    Role getByRoleId(Long id);

    void deleteById(List<Long> ids);

    @AutoFill(value = OperationType.INSERT)
    void add(Role role);

    @Insert("update sys_role set status =#{status}")
    @AutoFill(value = OperationType.UPDATE)
    void changeStatus(Role role);

    void update(Role role);
}
